package com.kun.comfig;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @className: Test02_filter
 * @Description: ...
 * @author: kunkun
 * @date: 2025/7/24 15:54
 */
@Component
public class Test02_filter implements GlobalFilter, Ordered {

    private Logger LOG = LoggerFactory.getLogger(Test02_filter.class);

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        LOG.info("日志打印-测试拦截器：Test02_filter");
        return chain.filter(exchange);      //请求继续
//        return exchange.getResponse().setComplete();    //请求终止
    }

    @Override
    public int getOrder() {
        return 2;
    }
}
